package com.canaan.business.controller.pc.agv;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import java.util.List;

import com.canaan.business.domain.agv.AgvTaskDispatchRecord;
import com.canaan.business.service.agv.IAgvTaskDispatchRecordService;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.canaan.common.annotation.Log;
import com.canaan.common.core.controller.BaseController;
import com.canaan.common.core.domain.AjaxResult;
import com.canaan.common.core.page.TableDataInfo;
import com.canaan.common.enums.BusinessType;
import com.canaan.common.utils.poi.ExcelUtil;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;

/**
 * AGV数据调度记录Controller
 *
 * @author
 * @date 2023-03-02
 */
@Api(tags = "AGV数据调度记录")
@RestController
@RequestMapping("/wcs/agvTaskDispatchRecord")
public class AgvTaskDispatchRecordController extends BaseController {
    @Resource
    private IAgvTaskDispatchRecordService agvTaskDispatchRecordService;

    /**
     * 查询AGV数据调度记录列表
     */
    @ApiOperation(value = "查询AGV数据调度记录列表")
    @PreAuthorize("@ss.hasPermi('wcs:agvTaskDispatchRecord:list')")
    @GetMapping("/list")
    public TableDataInfo list(AgvTaskDispatchRecord agvTaskDispatchRecord) {
        startPage();
        List<AgvTaskDispatchRecord> list = agvTaskDispatchRecordService.selectAgvTaskDispatchRecordList(agvTaskDispatchRecord);
        return getDataTable(list);
    }

    /**
     * 导出AGV数据调度记录列表
     */
    @ApiOperation(value = "导出AGV数据调度记录列表")
    @PreAuthorize("@ss.hasPermi('wcs:agvTaskDispatchRecord:export')")
    @Log(title = "AGV数据调度记录", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, AgvTaskDispatchRecord agvTaskDispatchRecord) {
        List<AgvTaskDispatchRecord> list = agvTaskDispatchRecordService.selectAgvTaskDispatchRecordList(agvTaskDispatchRecord);
        ExcelUtil<AgvTaskDispatchRecord> util = new ExcelUtil<AgvTaskDispatchRecord>(AgvTaskDispatchRecord.class);
        util.exportExcel(response, list, "AGV数据调度记录数据");
    }

    /**
     * 获取AGV数据调度记录详细信息
     */
    @ApiOperation(value = "获取AGV数据调度记录详细信息")
    @PreAuthorize("@ss.hasPermi('wcs:agvTaskDispatchRecord:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id) {
        return success(agvTaskDispatchRecordService.selectAgvTaskDispatchRecordById(id));
    }

    /**
     * 新增AGV数据调度记录
     */
    @ApiOperation(value = "新增AGV数据调度记录")
    @PreAuthorize("@ss.hasPermi('wcs:agvTaskDispatchRecord:add')")
    @Log(title = "AGV数据调度记录", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody AgvTaskDispatchRecord agvTaskDispatchRecord) {
        return toAjax(agvTaskDispatchRecordService.insertAgvTaskDispatchRecord(agvTaskDispatchRecord));
    }

    /**
     * 修改AGV数据调度记录
     */
    @ApiOperation(value = "修改AGV数据调度记录")
    @PreAuthorize("@ss.hasPermi('wcs:agvTaskDispatchRecord:edit')")
    @Log(title = "AGV数据调度记录", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody AgvTaskDispatchRecord agvTaskDispatchRecord) {
        return toAjax(agvTaskDispatchRecordService.updateAgvTaskDispatchRecord(agvTaskDispatchRecord));
    }

    /**
     * 删除AGV数据调度记录
     */
    @ApiOperation(value = "删除AGV数据调度记录")
    @PreAuthorize("@ss.hasPermi('wcs:agvTaskDispatchRecord:remove')")
    @Log(title = "AGV数据调度记录", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids) {
        return toAjax(agvTaskDispatchRecordService.deleteAgvTaskDispatchRecordByIds(ids));
    }
}
